﻿using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace OldFactory
{
    public partial class Tanks : UIUserControl
    {
        public Tanks()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 上面和中间的管线加在一起的占比
        /// </summary>
        public float PipeSize { get; set; } = 0.3f;
        public float Tanks01Size { get; set; } = 0.5f;
        public float Tanks02Size { get; set; } = 0.5f;
        private void Tanks_Load(object sender, EventArgs e)
        {
            Redraw();
        }
        public void Redraw()
        {
            panelMid.Height = Convert.ToInt32(Height * PipeSize * 0.5f);
            tanks01.Height = Convert.ToInt32(Height * (1 - PipeSize) * Tanks01Size);
            tanks02.Height = Convert.ToInt32(Height * (1 - PipeSize) * Tanks02Size);
            int pipeWidth = 16;
            pipe01.Top = 0;
            pipe01.Left = (Width - pipeWidth) / 2;
            pipe01.Height = tanks01.Top;
            pipe01.Width = pipeWidth;
            pipe02.Top = 0;
            pipe02.Height = panelMid.Height;
            pipe02.Width = pipeWidth;
            pipe02.Left = (Width - pipeWidth) / 2;
        }

        private void Tanks_Resize(object sender, EventArgs e)
        {
            Redraw();
        }
    }
}
